package com.zues.rabbit_self_test.service.work_queue;

import com.rabbitmq.client.Channel;
import com.zues.rabbit_self_test.utils.RabbitMqUtils;

/**
 * @ClassName WorkingQueueProducer
 * @Description TODO
 * @Author zeus
 * @Date 6/13/2025 8:28 上午
 * @Version 1.0
 **/
public class WorkingQueueProducer {

    private final static String QUEUE_NAME = "working_queue";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        channel.queueDeclare(QUEUE_NAME, true, false, false, null);
        //连续往工作队列中发送10条消息
        for (int i = 0; i < 10; i++) {
            String msg = "msg " + i;
            channel.basicPublish("", QUEUE_NAME, null, msg.getBytes());
            System.out.println("发送消息完成:" + msg);
        }
    }


}
